<!DOCTYPE html><html><head><title>README</title><link href="http://www.jboss.org/jdf/stylesheets/documentation.css" rel="stylesheet"></link><link href="http://www.jboss.org/jdf/stylesheets/pygments.css" rel="stylesheet"></link></head><body>
<h1><a id="logging-example-example-application-that-sets-up-different-logging-levels" class="anchor" href="#logging-example-example-application-that-sets-up-different-logging-levels"><span class="anchor-icon"></span></a>Logging Example: Example application that sets up different logging levels</h1>

<p>Author: Joel Tosi<br/>
Level: Intermediate<br/>
Technologies: Logging<br/>
Summary: Demonstrates how to set various application logging levels<br/>
Prerequisites: None<br/>
Target Product: EAP<br/>
Product Versions: EAP 6.1, EAP 6.2<br/>
Source: <a href="https://github.com/jboss-developer/jboss-eap-quickstarts/">https://github.com/jboss-developer/jboss-eap-quickstarts/</a>  </p>

<h2><a id="what-is-it" class="anchor" href="#what-is-it"><span class="anchor-icon"></span></a>What is it?</h2>

<p>This example demonstrates how to set up and log different levels of information in Red Hat JBoss Enterprise Application Platform. An example of asynchronous logging is also included in the configuration examples.</p>

<p>This quickstart contains just one class file and one JSP file. When you access the application, it fires off the logging information.</p>

<p>To better visualize how the logging configuration works, you first deploy and access the application before configuring the logs and view the resulting log files. Then you configure the logs, redeploy and access the application, and look at the log files again to see the differences.</p>

<h2><a id="system-requirements" class="anchor" href="#system-requirements"><span class="anchor-icon"></span></a>System requirements</h2>

<p>The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 6.1 or later. </p>

<p>All you need to build this project is Java 6.0 (Java SDK 1.6) or later, Maven 3.0 or later.</p>

<h2><a id="configure-maven" class="anchor" href="#configure-maven"><span class="anchor-icon"></span></a>Configure Maven</h2>

<p>If you have not yet done so, you must <a href="../README.html#configure-maven">Configure Maven</a> before testing the quickstarts.</p>

<h2><a id="start-the-jboss-server" class="anchor" href="#start-the-jboss-server"><span class="anchor-icon"></span></a>Start the JBoss Server</h2>

<ol>
<li>Open a command line and navigate to the root of the JBoss server directory.</li>
<li><p>The following shows the command line to start the server:</p>
<div class="highlight"><pre><span class="n">For</span> <span class="n">Linux</span><span class="o">:</span>   <span class="n">JBOSS_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">standalone</span><span class="p">.</span><span class="n">sh</span>
<span class="n">For</span> <span class="n">Windows</span><span class="o">:</span> <span class="n">JBOSS_HOME</span><span class="err">\</span><span class="n">bin</span><span class="err">\</span><span class="n">standalone</span><span class="p">.</span><span class="n">bat</span>
</pre></div></li>
</ol>

<h2><a id="build-and-deploy-the-quickstart" class="anchor" href="#build-and-deploy-the-quickstart"><span class="anchor-icon"></span></a>Build and Deploy the Quickstart</h2>

<p><em>NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See <a href="../README.html#build-and-deploy-the-quickstarts">Build and Deploy the Quickstarts</a> for complete instructions and additional options.</em></p>

<ol>
<li>Make sure you have started the JBoss Server as described above.</li>
<li>Open a command line and navigate to the root directory of this quickstart.</li>
<li><p>Type this command to build and deploy the archive:</p>
<div class="highlight"><pre><span class="n">mvn</span> <span class="n">clean</span> <span class="n">install</span> <span class="n">jboss</span><span class="o">-</span><span class="n">as</span><span class="o">:</span><span class="n">deploy</span>
</pre></div></li>
<li><p>This deploys <code>target/jboss-logging.war</code> to the running instance of the server.</p></li>
</ol>

<h2><a id="access-the-application-" class="anchor" href="#access-the-application-"><span class="anchor-icon"></span></a>Access the application </h2>

<p>The application is running at the following URL: <a href="http://localhost:8080/jboss-logging/">http://localhost:8080/jboss-logging/</a>.</p>

<h2><a id="check-the-server-logs" class="anchor" href="#check-the-server-logs"><span class="anchor-icon"></span></a>Check the Server Logs</h2>

<p>The log files are located in the <code>JBOSS_HOME/standalone/log</code> log directory. At this point you should see the following standard log files that are produced by the application server:</p>
<div class="highlight"><pre>    <span class="o">*</span> <span class="err">`</span><span class="n">server</span><span class="p">.</span><span class="n">log</span><span class="err">`</span> <span class="o">-</span> <span class="n">a</span> <span class="n">standard</span> <span class="n">log</span> <span class="n">files</span> <span class="n">produced</span> <span class="n">by</span> <span class="n">the</span> <span class="n">application</span> <span class="n">server</span>
    <span class="o">*</span> <span class="err">`</span><span class="n">boot</span><span class="p">.</span><span class="n">log</span><span class="err">`</span> <span class="o">-</span> <span class="n">a</span> <span class="n">standard</span> <span class="n">log</span> <span class="n">files</span> <span class="n">produced</span> <span class="n">by</span> <span class="n">the</span> <span class="n">application</span> <span class="n">server</span>
</pre></div>
<h2><a id="configure-the-logging-quickstart-log-file-handlers" class="anchor" href="#configure-the-logging-quickstart-log-file-handlers"><span class="anchor-icon"></span></a>Configure the Logging Quickstart Log File Handlers</h2>

<p>To test logging the different logging levels, you must add handlers to the server <code>logging.properties</code> file and configure the server to use them. </p>

<h3><a id="add-file-handlers-to-the-server-log-properties-file" class="anchor" href="#add-file-handlers-to-the-server-log-properties-file"><span class="anchor-icon"></span></a>Add File Handlers to the Server Log Properties File</h3>

<ol>
<li>Stop the application server.</li>
<li>Create a backup of the <code>logging.properties</code> file located in the <code>JBOSS_HOME/standalone/configuration</code> directory.</li>
<li><p>Open the <code>logging.properties</code> in an editor and find the following line:</p>

<ul>
<li><p>Find the line containing:</p>
<div class="highlight"><pre><span class="n">logger</span><span class="p">.</span><span class="n">handlers</span><span class="o">=</span><span class="n">CONSOLE</span><span class="p">,</span><span class="kt">FILE</span>
</pre></div>
<p><em>Note: Property value order is not guaranteed, so you may see <code>logger.handlers=FILE,CONSOLE</code> instead of the line above.</em></p>

<p>Replace that line with the following:</p>
<div class="highlight"><pre><span class="n">logger</span><span class="p">.</span><span class="n">handlers</span><span class="o">=</span><span class="kt">FILE</span><span class="p">,</span><span class="n">CONSOLE</span><span class="p">,</span><span class="n">FILE_QS_WARN</span><span class="p">,</span><span class="n">FILE_QS_ERROR</span><span class="p">,</span><span class="n">FILE_QS_INFO</span><span class="p">,</span><span class="n">FILE_QS_DEBUG</span><span class="p">,</span><span class="n">FILE_QS_TRACE</span><span class="p">,</span><span class="n">FILE_QS_FATAL</span>
</pre></div></li>
<li><p>Copy and paste the following file handler configuration lines at the end of the <code>logging.properties</code> file. </p>
<div class="highlight"><pre>##### New file handler config for quickstart example warnings
handler.FILE_QS_WARN=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_WARN.level=WARN
handler.FILE_QS_WARN.properties=autoFlush,fileName
handler.FILE_QS_WARN.autoFlush=true
handler.FILE_QS_WARN.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_warn</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_WARN.formatter=FILE

##### New file handler config for quickstart example errors
handler.FILE_QS_ERROR=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_ERROR.level=ERROR
handler.FILE_QS_ERROR.properties=autoFlush,fileName
handler.FILE_QS_ERROR.autoFlush=true
handler.FILE_QS_ERROR.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_error</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_ERROR.formatter=FILE

##### New file handler config for quickstart example info messages
handler.FILE_QS_INFO=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_INFO.level=INFO
handler.FILE_QS_INFO.properties=autoFlush,fileName
handler.FILE_QS_INFO.autoFlush=true
handler.FILE_QS_INFO.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_info</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_INFO.formatter=FILE

##### New file handler config for quickstart example debug messages
handler.FILE_QS_DEBUG=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_DEBUG.level=DEBUG
handler.FILE_QS_DEBUG.properties=autoFlush,fileName
handler.FILE_QS_DEBUG.autoFlush=true
handler.FILE_QS_DEBUG.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_debug</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_DEBUG.formatter=FILE

##### New file handler config for quickstart example trace messages
handler.FILE_QS_TRACE=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_TRACE.level=TRACE
handler.FILE_QS_TRACE.properties=autoFlush,fileName
handler.FILE_QS_TRACE.autoFlush=true
handler.FILE_QS_TRACE.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_trace</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_TRACE.formatter=FILE

##### New file handler config for quickstart example fatal messages
handler.FILE_QS_FATAL=org.jboss.logmanager.handlers.FileHandler
handler.FILE_QS_FATAL.level=FATAL
handler.FILE_QS_FATAL.properties=autoFlush,fileName
handler.FILE_QS_FATAL.autoFlush=true
handler.FILE_QS_FATAL.fileName=<span class="cp">${</span><span class="n">org</span><span class="o">.</span><span class="n">jboss</span><span class="o">.</span><span class="n">boot</span><span class="o">.</span><span class="n">log</span><span class="o">.</span><span class="n">file</span><span class="p">:</span><span class="n">quickstart_fatal</span><span class="o">.</span><span class="n">log</span><span class="cp">}</span>
handler.FILE_QS_FATAL.formatter=FILE
</pre></div></li>
</ul>

<p>The quickstart distribution also includes a <code>logging-properties.txt</code> file containing these configuration lines.</p></li>
</ol>

<h3><a id="configure-the-server-to-use-the-new-logging-handlers" class="anchor" href="#configure-the-server-to-use-the-new-logging-handlers"><span class="anchor-icon"></span></a>Configure the Server to Use the New Logging Handlers</h3>

<p>You can configure logging by running the <code>configure-logging.cli</code> script provided in the root directory of this quickstart, by using the JBoss CLI interactively, or by manually editing the configuration file. The three different approaches are described below. </p>

<p><em>NOTE - Before you begin:</em></p>

<ol>
<li>If it is running, stop the JBoss server.</li>
<li>Backup the file: <code>JBOSS_HOME/standalone/configuration/standalone.xml</code></li>
<li>After you have completed testing this quickstart, you can replace this file to restore the server to its original configuration.</li>
</ol>

<h4><a id="configure-logging-by-running-the-jboss-cli-script" class="anchor" href="#configure-logging-by-running-the-jboss-cli-script"><span class="anchor-icon"></span></a>Configure Logging by Running the JBoss CLI Script</h4>

<ol>
<li><p>Start the JBoss server by typing the following: </p>
<div class="highlight"><pre><span class="n">For</span> <span class="n">Linux</span><span class="o">:</span>  <span class="n">JBOSS_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">standalone</span><span class="p">.</span><span class="n">sh</span> 
<span class="n">For</span> <span class="n">Windows</span><span class="o">:</span>  <span class="n">JBOSS_HOME</span><span class="err">\</span><span class="n">bin</span><span class="err">\</span><span class="n">standalone</span><span class="p">.</span><span class="n">bat</span>
</pre></div></li>
<li><p>Open a new command line, navigate to the root directory of this quickstart, and run the following command, replacing JBOSS_HOME with the path to your server:</p>
<div class="highlight"><pre><span class="n">JBOSS_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">jboss</span><span class="o">-</span><span class="n">cli</span><span class="p">.</span><span class="n">sh</span> <span class="o">--</span><span class="n">connect</span> <span class="o">--</span><span class="n">file</span><span class="o">=</span><span class="n">configure</span><span class="o">-</span><span class="n">logging</span><span class="p">.</span><span class="n">cli</span>
</pre></div>
<p>This script configures the logging subsytem in the server configuration file. It configures the periodic rotating file handlers corresponding to those added to the logging properties file, configures the async handlers, creates the logger for our quickstart class and sets the level to TRACE, and assigns the async handlers for our quickstart class. 
You should see the following result when you run the script:</p>
<div class="highlight"><pre><span class="cp">#1 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_TRACE:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.trace.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#2 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_DEBUG:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.debug.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#3 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_INFO:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.info.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#4 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_WARN:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.warn.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#5 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_ERROR:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.error.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#6 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_FATAL:add(suffix=&quot;.yyyy.MM.dd&quot;, file={&quot;path&quot;=&gt;&quot;quickstart.fatal.log&quot;, &quot;relative-to&quot;=&gt;&quot;jboss.server.log.dir&quot;})</span>
<span class="cp">#7 /subsystem=logging/async-handler=TRACE_QS_ASYNC:add(level=TRACE,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_TRACE&quot;])</span>
<span class="cp">#8 /subsystem=logging/async-handler=DEBUG_QS_ASYNC:add(level=DEBUG,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_DEBUG&quot;])</span>
<span class="cp">#9 /subsystem=logging/async-handler=INFO_QS_ASYNC:add(level=INFO,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_INFO&quot;])</span>
<span class="cp">#10 /subsystem=logging/async-handler=WARN_QS_ASYNC:add(level=WARN,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_WARN&quot;])</span>
<span class="cp">#11 /subsystem=logging/async-handler=ERROR_QS_ASYNC:add(level=ERROR,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_ERROR&quot;])</span>
<span class="cp">#12 /subsystem=logging/async-handler=FATAL_QS_ASYNC:add(level=FATAL,queue-length=1024,overflow-action=BLOCK,subhandlers=[&quot;FILE_QS_FATAL&quot;])</span>
<span class="cp">#13 /subsystem=logging/logger=org.jboss.as.quickstarts.logging:add(level=TRACE,handlers=[TRACE_QS_ASYNC,DEBUG_QS_ASYNC,INFO_QS_ASYNC,WARN_QS_ASYNC,ERROR_QS_ASYNC,FATAL_QS_ASYNC])</span>
<span class="n">The</span> <span class="n">batch</span> <span class="n">executed</span> <span class="n">successfully</span>
</pre></div></li>
</ol>

<h4><a id="configure-logging-by-using-the-jboss-cli-tool-interactively" class="anchor" href="#configure-logging-by-using-the-jboss-cli-tool-interactively"><span class="anchor-icon"></span></a>Configure Logging by Using the JBoss CLI Tool Interactively</h4>

<ol>
<li><p>Start the JBoss server by typing the following: </p>
<div class="highlight"><pre><span class="n">For</span> <span class="n">Linux</span><span class="o">:</span>  <span class="n">JBOSS_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">standalone</span><span class="p">.</span><span class="n">sh</span> 
<span class="n">For</span> <span class="n">Windows</span><span class="o">:</span>  <span class="n">JBOSS_HOME</span><span class="err">\</span><span class="n">bin</span><span class="err">\</span><span class="n">standalone</span><span class="p">.</span><span class="n">bat</span> 
</pre></div></li>
<li><p>To start the JBoss CLI tool, open a new command line, navigate to the JBOSS_HOME directory, and type the following:</p>
<div class="highlight"><pre><span class="n">For</span> <span class="n">Linux</span><span class="o">:</span> <span class="n">bin</span><span class="o">/</span><span class="n">jboss</span><span class="o">-</span><span class="n">cli</span><span class="p">.</span><span class="n">sh</span> <span class="o">--</span><span class="n">connect</span>
<span class="n">For</span> <span class="n">Windows</span><span class="o">:</span> <span class="n">bin</span><span class="err">\</span><span class="n">jboss</span><span class="o">-</span><span class="n">cli</span><span class="p">.</span><span class="n">bat</span> <span class="o">--</span><span class="n">connect</span>
</pre></div></li>
<li><p>At the prompt, type each of the following commands. After each one, you should see a response with the first line <code>&quot;outcome&quot; =&gt; &quot;success&quot;</code>.</p>
<div class="highlight"><pre><span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_TRACE</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.trace.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_DEBUG</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.debug.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_INFO</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.info.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_WARN</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.warn.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_ERROR</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.error.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">periodic</span><span class="o">-</span><span class="n">rotating</span><span class="o">-</span><span class="n">file</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FILE_QS_FATAL</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">suffix</span><span class="o">=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="p">{</span><span class="s">&quot;path&quot;</span><span class="o">=&gt;</span><span class="s">&quot;quickstart.fatal.log&quot;</span><span class="p">,</span> <span class="s">&quot;relative-to&quot;</span><span class="o">=&gt;</span><span class="s">&quot;jboss.server.log.dir&quot;</span><span class="p">})</span>

<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">TRACE_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">TRACE</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_TRACE&quot;</span><span class="p">])</span> 
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">DEBUG_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">DEBUG</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_DEBUG&quot;</span><span class="p">])</span> 
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">INFO_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">INFO</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_INFO&quot;</span><span class="p">])</span> 
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">WARN_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">WARN</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_WARN&quot;</span><span class="p">])</span> 
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">ERROR_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">ERROR</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_ERROR&quot;</span><span class="p">])</span> 
<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">async</span><span class="o">-</span><span class="n">handler</span><span class="o">=</span><span class="n">FATAL_QS_ASYNC</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">FATAL</span><span class="p">,</span><span class="n">queue</span><span class="o">-</span><span class="n">length</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span><span class="n">overflow</span><span class="o">-</span><span class="n">action</span><span class="o">=</span><span class="n">BLOCK</span><span class="p">,</span><span class="n">subhandlers</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;FILE_QS_FATAL&quot;</span><span class="p">])</span> 

<span class="o">/</span><span class="n">subsystem</span><span class="o">=</span><span class="n">logging</span><span class="o">/</span><span class="n">logger</span><span class="o">=</span><span class="n">org</span><span class="p">.</span><span class="n">jboss</span><span class="p">.</span><span class="n">as</span><span class="p">.</span><span class="n">quickstarts</span><span class="p">.</span><span class="n">logging</span><span class="o">:</span><span class="n">add</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">TRACE</span><span class="p">,</span><span class="n">handlers</span><span class="o">=</span><span class="p">[</span><span class="n">TRACE_QS_ASYNC</span><span class="p">,</span><span class="n">DEBUG_QS_ASYNC</span><span class="p">,</span><span class="n">INFO_QS_ASYNC</span><span class="p">,</span><span class="n">WARN_QS_ASYNC</span><span class="p">,</span><span class="n">ERROR_QS_ASYNC</span><span class="p">,</span><span class="n">FATAL_QS_ASYNC</span><span class="p">])</span>
</pre></div></li>
</ol>

<h4><a id="configure-logging-by-manually-editing-the-server-configuration-file" class="anchor" href="#configure-logging-by-manually-editing-the-server-configuration-file"><span class="anchor-icon"></span></a>Configure Logging by Manually Editing the Server Configuration File</h4>

<ol>
<li>If it is running, stop the JBoss server.</li>
<li>Backup the file: <code>JBOSS_HOME/standalone/configuration/standalone.xml</code></li>
<li>Open the file: <code>JBOSS_HOME/standalone/configuration/standalone.xml</code></li>
<li><p>Locate the <code>logging</code> subsystem, identified by <code>&lt;subsystem xmlns=&quot;urn:jboss:domain:logging:1.1&quot;&gt;</code> in the file. Copy the following XML before the ending <code>&lt;/subsystem&gt;</code> element.</p>
<div class="highlight"><pre><span class="c">&lt;!-- EXAMPLE ASYNCHRONOUS LOGGER CONFIGURATION FOR QUICKSTART, NOTE IT LOGS TO FILES AS DEFINED BELOW --&gt;</span>
<span class="c">&lt;!-- Configure the logging async handlers --&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;TRACE_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;TRACE&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_TRACE&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;DEBUG_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;DEBUG&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_DEBUG&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;INFO_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;INFO&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_INFO&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;WARN_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;WARN&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_WARN&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;ERROR_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;ERROR&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_ERROR&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>
<span class="nt">&lt;async-handler</span> <span class="na">name=</span><span class="s">&quot;FATAL_QS_ASYNC&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;FATAL&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;queue-length</span> <span class="na">value=</span><span class="s">&quot;1024&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;overflow-action</span> <span class="na">value=</span><span class="s">&quot;block&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;subhandlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_FATAL&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/subhandlers&gt;</span>
<span class="nt">&lt;/async-handler&gt;</span>

<span class="c">&lt;!-- Add the periodic rotating file handlers corresponding to those added to the logging properties file --&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_TRACE&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.trace.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_DEBUG&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.debug.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_INFO&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.info.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_WARN&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.warn.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_ERROR&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.error.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>
<span class="nt">&lt;periodic-rotating-file-handler</span> <span class="na">name=</span><span class="s">&quot;FILE_QS_FATAL&quot;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;file</span> <span class="na">relative-to=</span><span class="s">&quot;jboss.server.log.dir&quot;</span> <span class="na">path=</span><span class="s">&quot;quickstart.fatal.log&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;suffix</span> <span class="na">value=</span><span class="s">&quot;.yyyy.MM.dd&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/periodic-rotating-file-handler&gt;</span>

<span class="c">&lt;!-- INITIALLY SET THE LOG LEVEL TO TRACE FOR THE EXAMPLE CALLS--&gt;</span>
<span class="nt">&lt;logger</span> <span class="na">category=</span><span class="s">&quot;org.jboss.as.quickstarts.logging&quot;</span><span class="nt">&gt;</span>
    <span class="c">&lt;!-- To view different logging levels, change the level below </span>
<span class="c">    from TRACE to DEBUG, INFO, WARN, ERROR, or FATAL, </span>
<span class="c">    then access the application.--&gt;</span>
    <span class="nt">&lt;level</span> <span class="na">name=</span><span class="s">&quot;TRACE&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;handlers&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;TRACE_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;DEBUG_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;INFO_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;WARN_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;ERROR_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
        <span class="nt">&lt;handler</span> <span class="na">name=</span><span class="s">&quot;FATAL_QS_ASYNC&quot;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/handlers&gt;</span>
<span class="nt">&lt;/logger&gt;</span>
</pre></div></li>
</ol>

<h3><a id="restart-the-server-and-test" class="anchor" href="#restart-the-server-and-test"><span class="anchor-icon"></span></a>Restart the Server and Test</h3>

<ol>
<li>If your server is not started (i.e. you didn&rsquo;t use one of the CLI routes), then <a href="#start-the-jboss-server">Start the server</a>.</li>
<li><a href="#build-and-deploy-the-quickstart">Build and deploy the quickstart</a>.</li>
<li><a href="#access-the-application">Access the application</a>.</li>
</ol>

<h2><a id="recheck-the-server-logs" class="anchor" href="#recheck-the-server-logs"><span class="anchor-icon"></span></a>Recheck the Server Logs</h2>

<p>The log files are located in the <code>JBOSS_HOME/standalone/log</code> log directory. You should now see 8 log files.</p>

<ul>
<li><p>The following logs are standard log files produced by the application server:</p>

<ul>
<li><code>server.log</code> - a standard log files produced by the application server</li>
<li><code>boot.log</code> - a standard log files produced by the application server</li>
</ul></li>
<li><p>The following logs are produced by the quickstart. They are listed in hierarchical order from the largest file containing the most messages to the smallest file containing the least messages. </p>

<ul>
<li><code>quickstart.trace.log</code></li>
<li><code>quickstart.debug.log</code></li>
<li><code>quickstart.info.log</code></li>
<li><code>quickstart.warn.log</code></li>
<li><code>quickstart.error.log</code></li>
<li><code>quickstart.fatal.log</code></li>
</ul></li>
</ul>

<p>The following describes what happens when you access this quickstart:</p>

<ol>
<li>The application class file fires off logs of the various types (INFO, DEBUG, TRACE, WARN, ERROR, FATAL).  Each log message goes to a different file, as defined in the <code>standalone.xml</code> and <code>logging.properties</code> files.  Also notice in the <code>standalone.xml</code> that the application package defines its own log level.</li>
<li>The class file demonstrates the usage of <em>log guards</em>.  <em>Log guards</em> are a development best practice.  Simply put, instead of just writing out logs, we wrap the log writes in a check for that log level being enabled. While this may seem like overhead, that boolean check is more efficient than relying on the underlying framework to do the check at write time.</li>
<li>Finally, the class file logs various levels, each to its own file as configured in <code>standalone.xml</code>.  Note that log levels are hierarchical.  When set, all log levels above the specified level are logged as well.</li>
<li><p>Common uses of the 6 log levels are outlined below. You should use the level that makes the most sense in your environment.</p>
<div class="highlight"><pre><span class="n">FATAL</span> <span class="o">-</span> <span class="n">Used</span> <span class="n">to</span> <span class="n">track</span> <span class="n">critical</span> <span class="n">system</span> <span class="n">failures</span><span class="p">.</span>  <span class="n">When</span> <span class="n">this</span> <span class="n">log</span> <span class="n">message</span> <span class="n">is</span> <span class="n">written</span><span class="p">,</span> <span class="n">it</span> <span class="n">is</span> <span class="n">writing</span> <span class="n">application</span> <span class="n">error</span> <span class="n">that</span> <span class="n">has</span> <span class="n">caused</span> <span class="n">service</span> <span class="n">to</span> <span class="n">cease</span><span class="p">.</span>  <span class="n">This</span> <span class="n">is</span> <span class="n">the</span> <span class="n">most</span> <span class="n">narrow</span> <span class="n">logging</span><span class="p">.</span>  
<span class="n">ERROR</span> <span class="o">-</span> <span class="n">Used</span> <span class="n">to</span> <span class="n">track</span> <span class="n">application</span> <span class="n">errors</span> <span class="n">that</span> <span class="n">may</span> <span class="n">cause</span> <span class="n">one</span> <span class="n">request</span> <span class="n">to</span> <span class="n">fail</span> <span class="p">(</span><span class="n">not</span> <span class="n">a</span> <span class="n">service</span> <span class="n">ceasement</span><span class="p">).</span>
<span class="n">WARN</span> <span class="o">-</span> <span class="n">This</span> <span class="n">is</span> <span class="n">setting</span> <span class="n">is</span> <span class="n">used</span> <span class="n">in</span> <span class="n">most</span> <span class="n">production</span> <span class="n">environments</span><span class="p">.</span>  <span class="n">At</span> <span class="n">this</span> <span class="n">level</span><span class="p">,</span> <span class="n">all</span> <span class="o">*</span><span class="n">WARN</span><span class="o">*</span><span class="p">,</span> <span class="o">*</span><span class="n">ERROR</span><span class="o">*</span><span class="p">,</span> <span class="n">and</span> <span class="o">*</span><span class="n">FATAL</span><span class="o">*</span> <span class="n">messages</span> <span class="n">are</span> <span class="n">written</span><span class="p">.</span>  <span class="n">Use</span> <span class="n">this</span> <span class="n">level</span> <span class="n">message</span>  <span class="n">as</span> <span class="n">a</span> <span class="n">predictive</span> <span class="n">measure</span> <span class="k">for</span> <span class="n">possible</span> <span class="n">forthcoming</span> <span class="n">issues</span><span class="p">.</span>  
<span class="n">INFO</span> <span class="o">-</span> <span class="n">Usually</span> <span class="n">only</span> <span class="n">used</span> <span class="n">in</span> <span class="n">a</span> <span class="n">development</span> <span class="n">environment</span><span class="p">.</span>  <span class="n">This</span> <span class="n">provides</span> <span class="n">any</span> <span class="n">information</span> <span class="o">-</span> <span class="n">state</span> <span class="n">transition</span><span class="p">,</span> <span class="n">object</span> <span class="n">values</span><span class="p">,</span> <span class="n">etc</span>
<span class="n">DEBUG</span> <span class="o">-</span> <span class="n">Turned</span> <span class="n">on</span> <span class="n">in</span> <span class="n">any</span> <span class="n">environment</span> <span class="n">when</span> <span class="n">a</span> <span class="n">problem</span> <span class="n">is</span> <span class="n">occuring</span><span class="p">.</span>  <span class="n">The</span> <span class="n">information</span> <span class="n">captured</span> <span class="n">may</span> <span class="n">be</span> <span class="n">throughput</span><span class="p">,</span> <span class="n">communication</span><span class="p">,</span> <span class="n">object</span> <span class="n">values</span><span class="p">,</span> <span class="n">etc</span><span class="p">.</span>
<span class="n">TRACE</span> <span class="o">-</span> <span class="n">Turned</span> <span class="n">on</span> <span class="n">in</span> <span class="n">any</span> <span class="n">environment</span> <span class="n">where</span> <span class="n">you</span> <span class="n">are</span> <span class="n">trying</span> <span class="n">to</span> <span class="n">follow</span> <span class="n">an</span> <span class="n">execution</span> <span class="n">path</span><span class="p">,</span> <span class="k">for</span> <span class="n">optimization</span> <span class="n">or</span> <span class="n">debugging</span><span class="p">.</span>  <span class="n">This</span> <span class="n">is</span> <span class="n">the</span> <span class="n">most</span> <span class="n">broad</span> <span class="n">logging</span> <span class="n">level</span> <span class="n">and</span> <span class="n">all</span> <span class="n">messages</span> <span class="n">are</span> <span class="n">written</span><span class="p">.</span>
</pre></div></li>
<li><p>To view log file differences for different logging levels, change the level for the &ldquo;org.jboss.as.quickstarts.logging&rdquo; logger 
from TRACE to DEBUG, INFO, WARN, ERROR, or FATAL, then access the application.</p></li>
</ol>

<h2><a id="undeploy-the-archive" class="anchor" href="#undeploy-the-archive"><span class="anchor-icon"></span></a>Undeploy the Archive</h2>

<ol>
<li>Make sure you have started the JBoss Server as described above.</li>
<li>Open a command line and navigate to the root directory of this quickstart.</li>
<li><p>When you are finished testing, type this command to undeploy the archive:</p>
<div class="highlight"><pre><span class="n">mvn</span> <span class="n">jboss</span><span class="o">-</span><span class="n">as</span><span class="o">:</span><span class="n">undeploy</span>
</pre></div></li>
</ol>

<h2><a id="remove-the-logging-configuration" class="anchor" href="#remove-the-logging-configuration"><span class="anchor-icon"></span></a>Remove the Logging Configuration</h2>

<h3><a id="restore-the-logging-properties-file" class="anchor" href="#restore-the-logging-properties-file"><span class="anchor-icon"></span></a>Restore the Logging Properties File</h3>

<ol>
<li>If it is running, stop the JBoss server.</li>
<li>Replace the <code>JBOSS_HOME/standalone/configuration/logging.properties</code> file with the back-up copy of the file.</li>
</ol>

<h3><a id="remove-the-server-logging-configuration" class="anchor" href="#remove-the-server-logging-configuration"><span class="anchor-icon"></span></a>Remove the Server Logging Configuration</h3>

<p>You can remove the logging configuration by running the  <code>remove-logging.cli</code> script provided in the root directory of this quickstart or by manually restoring the back-up copy the configuration file. </p>

<h4><a id="remove-the-logging-configuration-by-running-the-jboss-cli-script" class="anchor" href="#remove-the-logging-configuration-by-running-the-jboss-cli-script"><span class="anchor-icon"></span></a>Remove the Logging Configuration by Running the JBoss CLI Script</h4>

<ol>
<li><p>Start the JBoss server by typing the following: </p>
<div class="highlight"><pre><span class="n">For</span> <span class="n">Linux</span><span class="o">:</span>  <span class="n">JBOSS_HOME_SERVER_1</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">standalone</span><span class="p">.</span><span class="n">sh</span>
<span class="n">For</span> <span class="n">Windows</span><span class="o">:</span>  <span class="n">JBOSS_HOME_SERVER_1</span><span class="err">\</span><span class="n">bin</span><span class="err">\</span><span class="n">standalone</span><span class="p">.</span><span class="n">bat</span>
</pre></div></li>
<li><p>Open a new command line, navigate to the root directory of this quickstart, and run the following command, replacing JBOSS_HOME with the path to your server:</p>
<div class="highlight"><pre><span class="n">JBOSS_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">jboss</span><span class="o">-</span><span class="n">cli</span><span class="p">.</span><span class="n">sh</span> <span class="o">--</span><span class="n">connect</span> <span class="o">--</span><span class="n">file</span><span class="o">=</span><span class="n">remove</span><span class="o">-</span><span class="n">logging</span><span class="p">.</span><span class="n">cli</span> 
</pre></div>
<p>This script removes the log and file handlers from the <code>logging</code> subsystem in the server configuration. You should see the following result when you run the script:</p>
<div class="highlight"><pre><span class="cp">#1 /subsystem=logging/logger=org.jboss.as.quickstarts.logging:remove</span>
<span class="cp">#2 /subsystem=logging/async-handler=TRACE_QS_ASYNC:remove</span>
<span class="cp">#3 /subsystem=logging/async-handler=DEBUG_QS_ASYNC:remove</span>
<span class="cp">#4 /subsystem=logging/async-handler=INFO_QS_ASYNC:remove</span>
<span class="cp">#5 /subsystem=logging/async-handler=WARN_QS_ASYNC:remove</span>
<span class="cp">#6 /subsystem=logging/async-handler=ERROR_QS_ASYNC:remove</span>
<span class="cp">#7 /subsystem=logging/async-handler=FATAL_QS_ASYNC:remove</span>
<span class="cp">#8 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_TRACE:remove</span>
<span class="cp">#9 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_DEBUG:remove</span>
<span class="cp">#10 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_INFO:remove</span>
<span class="cp">#11 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_WARN:remove</span>
<span class="cp">#12 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_ERROR:remove</span>
<span class="cp">#13 /subsystem=logging/periodic-rotating-file-handler=FILE_QS_FATAL:remove</span>
<span class="n">The</span> <span class="n">batch</span> <span class="n">executed</span> <span class="n">successfully</span><span class="p">.</span>
<span class="p">{</span><span class="s">&quot;outcome&quot;</span> <span class="o">=&gt;</span> <span class="s">&quot;success&quot;</span><span class="p">}</span>
</pre></div></li>
</ol>

<h4><a id="remove-the-logging-configuration-manually" class="anchor" href="#remove-the-logging-configuration-manually"><span class="anchor-icon"></span></a>Remove the Logging Configuration Manually</h4>

<ol>
<li>If it is running, stop the JBoss server.</li>
<li>Replace the <code>JBOSS_HOME/standalone/configuration/standalone.xml</code> file with the back-up copy of the file.</li>
</ol>

<h2><a id="run-the-quickstart-in-jboss-developer-studio-or-eclipse" class="anchor" href="#run-the-quickstart-in-jboss-developer-studio-or-eclipse"><span class="anchor-icon"></span></a>Run the Quickstart in JBoss Developer Studio or Eclipse</h2>

<p>You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see <a href="../README.html#use-jboss-developer-studio-or-eclipse-to-run-the-quickstarts">Use JBoss Developer Studio or Eclipse to Run the Quickstarts</a> </p>

<h2><a id="debug-the-application" class="anchor" href="#debug-the-application"><span class="anchor-icon"></span></a>Debug the Application</h2>

<p>If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.</p>
<div class="highlight"><pre><span class="n">mvn</span> <span class="n">dependency</span><span class="o">:</span><span class="n">sources</span>
<span class="n">mvn</span> <span class="n">dependency</span><span class="o">:</span><span class="n">resolve</span> <span class="o">-</span><span class="n">Dclassifier</span><span class="o">=</span><span class="n">javadoc</span>
</pre></div></body></html>
